<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="lib.css" type='text/css' />
<link rel="SHORTCUT ICON" href="../icons/pyfav.png" type="image/png" />
<link rel='start' href='../index.html' title='Python documentation Index' />
<link rel="first" href="lib.html" title='Python library Reference' />
<link rel='contents' href='contents.html' title="Contents" />
<link rel='index' href='genindex.html' title='Index' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="node686.html" />
<link rel="prev" href="module-Tkinter.html" />
<link rel="parent" href="module-Tkinter.html" />
<link rel="next" href="node686.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>20.1.1 Tkinter Modules</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="20.1 tkinter  "
  href="module-Tkinter.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="20.1 tkinter  "
  href="module-Tkinter.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="20.1.2 tkinter Life Preserver"
  href="node686.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-Tkinter.html">20.1 Tkinter  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-Tkinter.html">20.1 Tkinter  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node686.html">20.1.2 Tkinter Life Preserver</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h2><a name="SECTION0022110000000000000000">
20.1.1 Tkinter Modules</a>
</h2>

<p>
Most of the time, the <tt class="module"><a href="module-Tkinter.html">Tkinter</a></tt> module is all you really
need, but a number of additional modules are available as well.  The
Tk interface is located in a binary module named <tt class="module">_tkinter</tt>.
This module contains the low-level interface to Tk, and should never
be used directly by application programmers. It is usually a shared
library (or DLL), but might in some cases be statically linked with
the Python interpreter.

<p>
In addition to the Tk interface module, <tt class="module"><a href="module-Tkinter.html">Tkinter</a></tt> includes a
number of Python modules. The two most important modules are the
<tt class="module"><a href="module-Tkinter.html">Tkinter</a></tt> module itself, and a module called
<tt class="module">Tkconstants</tt>. The former automatically imports the latter, so
to use Tkinter, all you need to do is to import one module:

<p>
<div class="verbatim"><pre>
import Tkinter
</pre></div>

<p>
Or, more often:

<p>
<div class="verbatim"><pre>
from Tkinter import *
</pre></div>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><span class="typelabel">class</span>&nbsp;<tt id='l2h-4701' xml:id='l2h-4701' class="class">Tk</tt></b>(</nobr></td>
  <td><var>screenName=None, baseName=None, className='Tk', useTk=1</var>)</td></tr></table></dt>
<dd>
The <tt class="class">Tk</tt> class is instantiated without arguments.
This creates a toplevel widget of Tk which usually is the main window
of an application. Each instance has its own associated Tcl interpreter.

<span class="versionnote">Changed in version 2.4:
The <var>useTk</var> parameter was added.</span>

</dl>

<p>
<dl><dt><table cellpadding="0" cellspacing="0"><tr valign="baseline">
  <td><nobr><b><tt id='l2h-4702' xml:id='l2h-4702' class="function">Tcl</tt></b>(</nobr></td>
  <td><var>screenName=None, baseName=None, className='Tk', useTk=0</var>)</td></tr></table></dt>
<dd>
The <tt class="function">Tcl</tt> function is a factory function which creates an
object much like that created by the <tt class="class">Tk</tt> class, except that it
does not initialize the Tk subsystem.  This is most often useful when
driving the Tcl interpreter in an environment where one doesn't want
to create extraneous toplevel windows, or where one cannot (such as
<span class="Unix">Unix</span>/Linux systems without an X server).  An object created by the
<tt class="function">Tcl</tt> object can have a Toplevel window created (and the Tk
subsystem initialized) by calling its <tt class="method">loadtk</tt> method.

<span class="versionnote">New in version 2.4.</span>

</dl>

<p>
Other modules that provide Tk support include:

<p>
<dl>
<dt><strong><tt class="module"><a href="module-ScrolledText.html">ScrolledText</a></tt></strong></dt>
<dd>Text widget with a vertical scroll bar built in.

<p>
</dd>
<dt><strong><tt class="module">tkColorChooser</tt></strong></dt>
<dd>Dialog to let the user choose a color.

<p>
</dd>
<dt><strong><tt class="module">tkCommonDialog</tt></strong></dt>
<dd>Base class for the dialogs defined in the other modules listed here.

<p>
</dd>
<dt><strong><tt class="module">tkFileDialog</tt></strong></dt>
<dd>Common dialogs to allow the user to specify a file to open or save.

<p>
</dd>
<dt><strong><tt class="module">tkFont</tt></strong></dt>
<dd>Utilities to help work with fonts.

<p>
</dd>
<dt><strong><tt class="module">tkMessageBox</tt></strong></dt>
<dd>Access to standard Tk dialog boxes.

<p>
</dd>
<dt><strong><tt class="module">tkSimpleDialog</tt></strong></dt>
<dd>Basic dialogs and convenience functions.

<p>
</dd>
<dt><strong><tt class="module">Tkdnd</tt></strong></dt>
<dd>Drag-and-drop support for <tt class="module"><a href="module-Tkinter.html">Tkinter</a></tt>.
This is experimental and should become deprecated when it is replaced 
with the Tk DND.

<p>
</dd>
<dt><strong><tt class="module"><a href="module-turtle.html">turtle</a></tt></strong></dt>
<dd>Turtle graphics in a Tk window.

<p>
</dd>
</dl>

<p>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="20.1 tkinter  "
  href="module-Tkinter.html"><img src='../icons/previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="20.1 tkinter  "
  href="module-Tkinter.html"><img src='../icons/up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="20.1.2 tkinter Life Preserver"
  href="node686.html"><img src='../icons/next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">Python Library Reference</td>
<td class='online-navigation'><a rel="contents" title="Table of Contents"
  href="contents.html"><img src='../icons/contents.png'
  border='0' height='32'  alt='Contents' width='32' /></a></td>
<td class='online-navigation'><a href="modindex.html" title="Module Index"><img src='../icons/modules.png'
  border='0' height='32'  alt='Module Index' width='32' /></a></td>
<td class='online-navigation'><a rel="index" title="Index"
  href="genindex.html"><img src='../icons/index.png'
  border='0' height='32'  alt='Index' width='32' /></a></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="module-Tkinter.html">20.1 Tkinter  </a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="module-Tkinter.html">20.1 Tkinter  </a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node686.html">20.1.2 Tkinter Life Preserver</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.5.1, documentation updated on 18th April, 2007.</span>
</div>
<!--End of Navigation Panel-->
<address>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</address>
</body>
</html>
